// 计算评分 满分 5分
// 目前按照 四个标准评分 (公司注册资金、成立时长、成功投标个数、公司规模)
const comput = (obj) => {
  const num = [0, 0, 0, 0, 0]
  if (obj.money < 100) {
    num[0] = 2
  } else if (obj.money < 500) {
    num[0] = 4
  } else if (obj.money < 1000) {
    num[0] = 6
  } else if (obj.money < 5000) {
    num[0] = 8
  } else {
    num[0] = 10
    num[4] = num[4] + 3
  }

  if (obj.year > 2020) {
    num[1] = 2
  } else if (obj.year > 2015) {
    num[1] = 4
  } else if (obj.year > 2010) {
    num[1] = 6
  } else if (obj.year > 2005) {
    num[1] = 8
  } else {
    num[1] = 10
    num[4] = num[4] + 2
  }

  if (obj.projectNumber < 10) {
    num[2] = 2
  } else if (obj.projectNumber < 30) {
    num[2] = 4
  } else if (obj.projectNumber < 60) {
    num[2] = 6
  } else if (obj.projectNumber < 100) {
    num[2] = 8
  } else {
    num[2] = 10
    num[4] = num[4] + 3
  }

  if (obj.number < 100) {
    num[3] = 2
  } else if (obj.number < 500) {
    num[3] = 4
  } else if (obj.number < 1000) {
    num[3] = 6
  } else if (obj.number < 5000) {
    num[3] = 8
  } else {
    num[3] = 10
    num[4] = num[4] + 2
  }

  const sum = num.reduce((sum, item) => sum + item, 0)
  return sum / 10
}

export {
  comput
}
